/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package GUI_algemeen;

import javax.swing.JOptionPane;

/**
 *
 * @author patje
 */
public class instellingenBeest extends javax.swing.JPanel {
    
   

    /**
     * Creates new form instellingenBeest
     */
    public instellingenBeest() {
        initComponents();
    }
    

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        label1 = new java.awt.Label();
        label2 = new java.awt.Label();
        label3 = new java.awt.Label();
        jTextFieldAantalPoten = new javax.swing.JTextField();
        jTextFieldMaximaalGewicht = new javax.swing.JTextField();
        jTextFieldMaximaalEnergieNiveau = new javax.swing.JTextField();

        label1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        label1.setText("Aantal poten");

        label2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        label2.setText("Maximaal gewicht");

        label3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        label3.setName(""); // NOI18N
        label3.setText("Maximaal energiniveau");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(label3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(label2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(48, 48, 48)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jTextFieldMaximaalGewicht, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 50, Short.MAX_VALUE)
                    .addComponent(jTextFieldAantalPoten, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jTextFieldMaximaalEnergieNiveau))
                .addContainerGap(168, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(13, 13, 13)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextFieldAantalPoten, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(label2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextFieldMaximaalGewicht, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(20, 20, 20)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(label3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextFieldMaximaalEnergieNiveau, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(189, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField jTextFieldAantalPoten;
    private javax.swing.JTextField jTextFieldMaximaalEnergieNiveau;
    private javax.swing.JTextField jTextFieldMaximaalGewicht;
    private java.awt.Label label1;
    private java.awt.Label label2;
    private java.awt.Label label3;
    // End of variables declaration//GEN-END:variables

   
    public int getAantalPoten()
    {
        try
        {
            int aantalPoten = Integer.valueOf(this.jTextFieldAantalPoten.getText());   
            if ( aantalPoten > 0 )
                return aantalPoten;
            else
                return -1;
        }
        catch (NumberFormatException ex)
        {
            JOptionPane.showMessageDialog(null,"U moet alle velden juist invullen : " + ex.getMessage(),"ERROR",JOptionPane.ERROR_MESSAGE);  
            return -1;
        }
    }
    
    public int getMaximaalGewicht()
    {
        try
        {
            int maxGewicht = Integer.valueOf(this.jTextFieldMaximaalGewicht.getText());
            if (maxGewicht >0 )
                return maxGewicht;
            else
                return -1;       
        }
        catch (NumberFormatException ex)
        {
           JOptionPane.showMessageDialog(null,"U moet alle velden juist invullen : " + ex.getMessage(),"ERROR",JOptionPane.ERROR_MESSAGE);  
            return -1; 
        }
    }
        
    public int getMaximaalEnergie()
    {
        try
        {
            int maxEnergie = Integer.valueOf(this.jTextFieldMaximaalEnergieNiveau.getText());
            if (maxEnergie >0 )
                return maxEnergie;
            else
                return -1;
        }
        catch (NumberFormatException ex)
         {
           JOptionPane.showMessageDialog(null,"U moet alle velden juist invullen : " + ex.getMessage(),"ERROR",JOptionPane.ERROR_MESSAGE);  
            return -1; 
        }   
    }
    
    public void setAantalPoten(int aantal)
    {
        this.jTextFieldAantalPoten.setText(""+ aantal);
    }
    public void setMaxGewicht (int gewicht)
    {
        this.jTextFieldMaximaalGewicht.setText(""+gewicht);
    }
    public void setMaxEnergie(int energie)
    {
        this.jTextFieldMaximaalEnergieNiveau.setText(""+ energie);
    }
}